<?php
if (!defined('PATH'))
	exit();
if ($guildList->count() > 0) {
?>
<table border="0" cellpadding="8" cellspacing="1" width="100%">
<tr class="head"><td colspan="3"><b>Guilds on <?=$this->config['server']['name']?></b></td></tr>
<tr class="bold"><td width="64px">Logo</td><td>Description</td><td></td></tr>
<?php
foreach($guildList as $guild) {
	$description = $guild->getCustomField('description');
	$newlines   = array("\r\n", "\n", "\r");
	$description_with_lines = str_replace($newlines, '<br />', $description, $count);
	if($count < $this->config['website']['guild']['descriptionLinesLimit'])
		$description = $description_with_lines;
	$guildLogo = $guild->getId().'.'.$this->config['website']['guild']['ext'];
	if(empty($guildLogo) || !file_exists('media/images/guild_logo/'.$guildLogo))
		$guildLogo = "default_logo.gif";
?>
<tr><td><img src="<?=PATH?>/media/images/guild_logo/<?=$guildLogo?>"/></td><td valign="top"><b><?=$guild->getName()?></b><br/><?=$description?></td><td width="10%" align="center"><a href="<?=PATH?>/guilds/show/<?=$guild->getId()?>/">View</a></td></tr>
<?php
}
?>
</table>
<?php
} else {
	$this->archez->showMsg('There aren\'t any guilds on <b>'.$this->config['server']['name'].'</b>.', 'notice');
}
?>
<br/>
<form action="<?=PATH?>/guilds/create/" method="POST">
	<input type="submit" name="create" value="Create new guild" style="width: auto;"/>
</form>
